package com.logica.hackthon;

import javax.servlet.ServletException;

import com.flca.Bootstrapper;
import com.flca.IFlcaStartup;
import com.flca.frw.log.LogHelper;
import com.flca.servlet.StartupServletBase;

/**
 * The fq classname of the FlcaSetup is coming from the init-param : flca.setup
 * This may be either the classname, or the name of a system-property containing the fq classname.
 * In addition there is an init-param: flca.properties
 * Also this property may point to a properties file directly, or point to a system property containing the name of the properties file.
 */  

public class HackThonStartupServlet extends StartupServletBase
{
	private static final long serialVersionUID = 5374333894976175140L;

	@SuppressWarnings("unused")
	private static IFlcaStartup starter;
	
	public HackThonStartupServlet() {
        super();
    }

	public void init() throws ServletException
    {
		LogHelper.useLogger(LogHelper.LoggingFrameworkEnum.USE_LOG4J);
		
    	logInfo("Starting " + this.getClass().getName() + " ...");
		try {
			starter = Bootstrapper.startup(getGuiceModuleName());
		    logInfo(this.getClass().getName() + " succesfully ended");
		} catch (Exception e) {
			logInfo("error in initialising services " + e);
			throw new RuntimeException(e);
		}
    }

/*   
	private void setupConnections() 
	{
    	logInfo("Setting up 2 default dbs connections");

    	IPersistenceMgr conns[] = new IPersistenceMgr[2];
		
		for (int i = 0; i < conns.length; i++) {
			conns[i] = ConnectionPoolMgr.getInstance().getObjectManager(); ;
		}

		for (int i = 0; i < conns.length; i++) {
			ConnectionPoolMgr.getInstance().returnObjectManager(conns[i]);
		}
	}
*/
}
